home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 21 / CU Amiga Magazine's Super CD-ROM 21 (1998)(EMAP Images)(GB)[!][issue 1998-04].iso / C / MakeAssigns < prev    next >
Text File  |  1997-06-18  |  1KB  |  53 lines

  1. /* $VER: MakeAssigns 1.1 (23.12.96) by Neil Bothwick           */
  2. /* Sets up or removes system assigns and paths for a CD        */
  3.  
  4. /* Usage: MakeAssigns [REMOVE]                                 */
  5. /* The assigns must be defines in S:CUCDassigns in the format  */
  6. /* AssignName:  Path                                           */
  7. /* and the paths in S:CUCDpaths in the format                  */
  8. /* Path                                                        */
  9.  
  10. parse arg switch
  11.  
  12. if upper(switch) = 'REMOVE' then do
  13.     call DoPaths
  14.     call DoAssigns
  15.     end
  16. else do
  17.     call DoAssigns
  18.     call DoPaths
  19.     end
  20.  
  21. exit
  22.  
  23.  
  24. DoAssigns:
  25.     if ~open(AssList,'S:CUCDassigns','R') then exit
  26.     do until eof(AssList)
  27.         Line = readln(AssList)
  28.         if left(Line,1) = ';' then iterate
  29.         if words(Line) ~= 2 then iterate
  30.         parse var Line Name Path .
  31.         cmdstr = 'assign >NIL:' '"'Name'"' '"'Path'"'
  32.         if upper(switch) = 'REMOVE' then cmdstr = cmdstr 'REMOVE'
  33.         address command cmdstr
  34.         end
  35.     call close(AssList)
  36.     return
  37.  
  38. DoPaths:
  39.     if ~open(PathList,'S:CUCDpaths','R') then exit
  40.     do until eof(PathList)
  41.         Path = readln(PathList)
  42.         if left(Path,1) = ';' then iterate
  43.         if words(Path) ~= 1 then iterate
  44.         cmdstr = 'Path >NIL:' '"'Path'"'
  45.         if upper(switch) = 'REMOVE' then cmdstr = cmdstr 'REMOVE'
  46.         else CmdStr = CmdStr 'ADD'
  47.         address command cmdstr
  48.         end
  49.  
  50.     call close(PathList)
  51.     return
  52.  
  53.